import Vue from 'vue'
import Router from 'vue-router'
//import HelloWorld from '@/components/HelloWorld'
import Login from '@/views/Login'
const Index = () => import("@/views/Index")

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: "/home"
    },
    {
      path: '/login',
      name: "Login",
      component: Login,
    }, {
      path: '/users',
      name: "users",
      component: () => import('../views/users.vue'),
    },
    {
      path: '/Index',
      name: 'Index',
      component: Index,
      meta: {
        title: "首页",
        requireAuth: true
      },
      //component: () => import('../views/Index.vue'),
      children: [{
        path: '/home',
        name: 'home',
        component: () => import('../views/home.vue'),

      },
      {
        path: '/user',
        name: 'user',
        component: () => import('../views/user.vue'),

      },
      { //商品管理页面
        path: '/goods',
        name: 'goods',
        component: () => import('../views/shangpin/goods.vue'),

      },
      { //添加商品页面
        path: '/additem',
        name: 'additem',
        component: () => import('../views/shangpin/addItem.vue'),

      },
      { //商品详情页
        path: '/deatil/:id',
        name: 'deatil',
        component: () => import('../views/shangpin/deatil.vue'),

      },
      { //商品编辑页
        path: '/editing/:id',
        name: 'editing',
        component: () => import('../views/shangpin/editing.vue'),

      },
      { //订单管理页
        path: '/order',
        name: 'order',
        component: () => import('../views/dingdan/order.vue'),

      },
      { //订单详情页
        path: '/details/',
        name: 'details',
        component: () => import('../views/dingdan/details.vue'),

      },
      { //品类管理页
        path: '/category',
        name: 'category',
        component: () => import('../views/pinlei/category.vue'),
      }, {
        path: '/addItems',
        name: 'addItems',
        component: () => import('../views/pinlei/addItems.vue'),
        meta: {
          title: '添加子类',
          requireAuth: true
        },
      }
      ]
    },
  ]
})
